package cn.com.cnxfs.relaxchat.controller;

import cn.com.cnxfs.relaxchat.service.IPhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping(value = "/photo")
public class PhotoController {
    @Autowired
    private IPhotoService iPhotoService;

    @RequestMapping(value="/upload",method = RequestMethod.POST)
    String upload(@RequestParam("file") MultipartFile file){
        return iPhotoService.upload(file);
    }

    @RequestMapping(value="/del",method = RequestMethod.POST)
    void del(@RequestParam String name){
        iPhotoService.del(name);
    }

}
